<div class="container-fluid">
    <div class="block-header">
        <h2>用户 > 联盟系统 > 联盟设置</h2>
    </div>
    <!-- Vertical Layout -->
    <div class="row">
        <div class="col-lg-6 col-md-6">
            <div class="card">
                <div class="header">
                    <h2>联盟设置</h2>
                </div>
                <div class="body">
                    <div class="alert alert-success affiliates-settings-alert"></div>
                    <form class="affiliates-settings" method="POST">
                        <label for="affiliate_system">联盟系统</label>
                        <div class="form-group">
                            <input type="radio" name="affiliate_system" id="affiliate_system-enabled" value="1" <?php echo ($wo['config']['affiliate_system'] == 1) ? 'checked': '';?>>
                            <label for="affiliate_system-enabled">启用</label>
                            <input type="radio" name="affiliate_system" id="affiliate_system-disabled" value="0" <?php echo ($wo['config']['affiliate_system'] == 0) ? 'checked': '';?>>
                            <label for="affiliate_system-disabled" class="m-l-20">禁用</label>
                        </div>
                        <label for="affiliate_type">用户将在何时赚钱</label>
                        <select class="form-control show-tick" id="affiliate_type" name="affiliate_type">
                          <option value="0" <?php echo ($wo['config']['affiliate_type'] == 0) ? 'selected': '';?> >新用户已注册</option>
                          <option value="1" <?php echo ($wo['config']['affiliate_type'] == 1) ? 'selected': '';?> >新用户已注册或购买专业包</option>
                        </select>
                        <div class="clearfix"></div>
                        <br><br>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <input type="text" id="m_withdrawal" name="m_withdrawal" class="form-control" value="<?php echo $wo['config']['m_withdrawal']?>">
                                <label class="form-label">最低提款请求</label>
                            </div>
                        </div><br>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <input type="text" id="amount_ref" name="amount_ref" class="form-control" value="<?php echo $wo['config']['amount_ref']?>">
                                <label class="form-label">数量 <small>您为每个新推介用户支付的价格。 默认值0.10</small></label>
                            </div>
                        </div>
                        <input type="hidden" name="hash_id" value="<?php echo Wo_CreateSession();?>">
                        <button type="submit" class="btn btn-primary m-t-15 waves-effect">保存</button>
                    </form>
                </div>
            </div>
        </div>
        <div class="clearfix"></div>
    </div>
    <!-- #END# Vertical Layout -->
<script>
$(function() {
    var form_affiliates_settings = $('form.affiliates-settings');
    form_affiliates_settings.ajaxForm({
        url: Wo_Ajax_Requests_File() + '?f=admin_setting&s=update_general_setting',
        beforeSend: function() {
            form_affiliates_settings.find('.waves-effect').text('请稍后..');
        },
        success: function(data) {
            if (data.status == 200) {
                form_affiliates_settings.find('.waves-effect').text('保存');
                $("html, body").animate({ scrollTop: 0 }, "slow");
                $('.affiliates-settings-alert').html('<i class="fa fa-check"></i> 设置更新成功');
                setTimeout(function () {
                    $('.affiliates-settings-alert').empty();
                }, 2000);
            }
        }
    });
});
</script>